/**
 * Created with JetBrains WebStorm.
 * User: Steven
 * Date: 25-4-13
 * Time: 20:20
 * To change this template use File | Settings | File Templates.
 */

/**
 * Race class. Description to come.
 *
 * @param name
 * @constructor
 */
function Race(name)
{
    this.id = -1; // Unique ID of the race
    this.name = name;
    this.skillModifiers = {};
    this.attributeModifiers = {};
}

Race.prototype.addSkillModifier = function(skillType, value)
{
    this.skillModifiers[skillType] = value;
};

Race.prototype.addAttributeModifier = function(attributeType, value)
{
    this.attributeModifiers[attributeType] = value;
};

Race.prototype.getSkillModifier = function(skillType)
{
    return skillType in this.skillModifiers ? this.skillModifiers[skillType] : 0;
};

Race.prototype.getAttributeModifier = function(attributeType)
{
    return attributeType in this.attributeModifiers ? this.attributeModifiers[attributeType] : 0;
};

// Race collection for enumerating through races. Collection is filled with race class types.
Race.races = [];

Race.races.push(Argonian);
Argonian.prototype = new Race("Argonian");
Argonian.prototype.constructor = Race;
function Argonian()
{
    this.id = 0;
    this.addSkillModifier(SkillTypes.blade, 5);
    this.addSkillModifier(SkillTypes.handtohand, 5);
    this.addSkillModifier(SkillTypes.alchemy, 5);
    this.addSkillModifier(SkillTypes.mysticism, 5);
    this.addSkillModifier(SkillTypes.security, 10);
    this.addSkillModifier(SkillTypes.athletics, 10);
    this.addSkillModifier(SkillTypes.illusion, 5);
    this.addAttributeModifier(AttributeTypes.strength, 10);
    this.addAttributeModifier(AttributeTypes.intelligence, 10);
    this.addAttributeModifier(AttributeTypes.agility, 20);
    this.addAttributeModifier(AttributeTypes.speed, 20);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(Breton);
Breton.prototype = new Race("Breton");
Breton.prototype.constructor = Race;
function Breton()
{
    this.id = 1;
    this.addSkillModifier(SkillTypes.alchemy, 5);
    this.addSkillModifier(SkillTypes.conjuration, 10);
    this.addSkillModifier(SkillTypes.mysticism, 10);
    this.addSkillModifier(SkillTypes.alteration, 5);
    this.addSkillModifier(SkillTypes.restoration, 10);
    this.addSkillModifier(SkillTypes.illusion, 5);
    this.addAttributeModifier(AttributeTypes.strength, 10);
    this.addAttributeModifier(AttributeTypes.intelligence, 20);
    this.addAttributeModifier(AttributeTypes.willpower, 20);
    this.addAttributeModifier(AttributeTypes.personality, 10);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(DarkElf);
DarkElf.prototype = new Race("Dark Elf");
DarkElf.prototype.constructor = Race;
function DarkElf()
{
    this.id = 2;
    this.addSkillModifier(SkillTypes.blade, 10);
    this.addSkillModifier(SkillTypes.blunt, 5);
    this.addSkillModifier(SkillTypes.mysticism, 5);
    this.addSkillModifier(SkillTypes.destruction, 10);
    this.addSkillModifier(SkillTypes.marksmanship, 5);
    this.addSkillModifier(SkillTypes.athletics, 5);
    this.addSkillModifier(SkillTypes.lightarmor, 5);
    this.addAttributeModifier(AttributeTypes.strength, 10);
    this.addAttributeModifier(AttributeTypes.intelligence, 10);
    this.addAttributeModifier(AttributeTypes.agility, 10);
    this.addAttributeModifier(AttributeTypes.speed, 20);
    this.addAttributeModifier(AttributeTypes.endurance, 10);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(HighElf);
HighElf.prototype = new Race("High Elf");
HighElf.prototype.constructor = Race;
function HighElf()
{
    this.id = 3;
    this.addSkillModifier(SkillTypes.alchemy, 5);
    this.addSkillModifier(SkillTypes.conjuration, 5);
    this.addSkillModifier(SkillTypes.mysticism, 10);
    this.addSkillModifier(SkillTypes.alteration, 10);
    this.addSkillModifier(SkillTypes.destruction, 10);
    this.addSkillModifier(SkillTypes.illusion, 5);
    this.addAttributeModifier(AttributeTypes.intelligence, 20);
    this.addAttributeModifier(AttributeTypes.willpower, 10);
    this.addAttributeModifier(AttributeTypes.agility, 10);
    this.addAttributeModifier(AttributeTypes.endurance, 10);
    this.addAttributeModifier(AttributeTypes.personality, 10);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(Imperial);
Imperial.prototype = new Race("Imperial");
Imperial.prototype.constructor = Race;
function Imperial()
{
    this.id = 4;
    this.addSkillModifier(SkillTypes.blade, 5);
    this.addSkillModifier(SkillTypes.blunt, 5);
    this.addSkillModifier(SkillTypes.handtohand, 5);
    this.addSkillModifier(SkillTypes.heavyarmor, 10);
    this.addSkillModifier(SkillTypes.mercantile, 10);
    this.addSkillModifier(SkillTypes.speechcraft, 10);
    this.addAttributeModifier(AttributeTypes.strength, 10);
    this.addAttributeModifier(AttributeTypes.intelligence, 10);
    this.addAttributeModifier(AttributeTypes.speed, 10);
    this.addAttributeModifier(AttributeTypes.endurance, 10);
    this.addAttributeModifier(AttributeTypes.personality, 20);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(Khajiit);
Khajiit.prototype = new Race("Khajiit");
Khajiit.prototype.constructor = Race;
function Khajiit()
{
    this.id = 5;
    this.addSkillModifier(SkillTypes.blade, 5);
    this.addSkillModifier(SkillTypes.handtohand, 10);
    this.addSkillModifier(SkillTypes.security, 5);
    this.addSkillModifier(SkillTypes.sneak, 5);
    this.addSkillModifier(SkillTypes.acrobatics, 10);
    this.addSkillModifier(SkillTypes.athletics, 5);
    this.addSkillModifier(SkillTypes.lightarmor, 5);
    this.addAttributeModifier(AttributeTypes.strength, 10);
    this.addAttributeModifier(AttributeTypes.intelligence, 10);
    this.addAttributeModifier(AttributeTypes.agility, 20);
    this.addAttributeModifier(AttributeTypes.speed, 10);
    this.addAttributeModifier(AttributeTypes.personality, 10);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(Nord);
Nord.prototype = new Race("Nord");
Nord.prototype.constructor = Race;
function Nord()
{
    this.id = 6;
    this.addSkillModifier(SkillTypes.blade, 10);
    this.addSkillModifier(SkillTypes.blunt, 10);
    this.addSkillModifier(SkillTypes.restoration, 5);
    this.addSkillModifier(SkillTypes.armorer, 5);
    this.addSkillModifier(SkillTypes.block, 5);
    this.addSkillModifier(SkillTypes.heavyarmor, 10);
    this.addAttributeModifier(AttributeTypes.strength, 20);
    this.addAttributeModifier(AttributeTypes.agility, 10);
    this.addAttributeModifier(AttributeTypes.speed, 10);
    this.addAttributeModifier(AttributeTypes.endurance, 20);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(Orc);
Orc.prototype = new Race("Orc");
Orc.prototype.constructor = Race;
function Orc()
{
    this.id = 7;
    this.addSkillModifier(SkillTypes.blunt, 10);
    this.addSkillModifier(SkillTypes.handtohand, 5);
    this.addSkillModifier(SkillTypes.armorer, 10);
    this.addSkillModifier(SkillTypes.block, 10);
    this.addSkillModifier(SkillTypes.heavyarmor, 10);
    this.addAttributeModifier(AttributeTypes.strength, 15);
    this.addAttributeModifier(AttributeTypes.willpower, 20);
    this.addAttributeModifier(AttributeTypes.agility, 5);
    this.addAttributeModifier(AttributeTypes.endurance, 20);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(Redguard);
Redguard.prototype = new Race("Redguard");
Redguard.prototype.constructor = Race;
function Redguard()
{
    this.id = 8;
    this.addSkillModifier(SkillTypes.blade, 10);
    this.addSkillModifier(SkillTypes.blunt, 10);
    this.addSkillModifier(SkillTypes.athletics, 10);
    this.addSkillModifier(SkillTypes.lightarmor, 5);
    this.addSkillModifier(SkillTypes.heavyarmor, 5);
    this.addSkillModifier(SkillTypes.mercantile, 5);
    this.addAttributeModifier(AttributeTypes.strength, 20);
    this.addAttributeModifier(AttributeTypes.agility, 10);
    this.addAttributeModifier(AttributeTypes.speed, 10);
    this.addAttributeModifier(AttributeTypes.endurance, 20);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}

Race.races.push(WoodElf);
WoodElf.prototype = new Race("Wood Elf");
WoodElf.prototype.constructor = Race;
function WoodElf()
{
    this.id = 9;
    this.addSkillModifier(SkillTypes.alchemy, 10);
    this.addSkillModifier(SkillTypes.alteration, 5);
    this.addSkillModifier(SkillTypes.marksmanship, 10);
    this.addSkillModifier(SkillTypes.sneak, 10);
    this.addSkillModifier(SkillTypes.acrobatics, 5);
    this.addSkillModifier(SkillTypes.lightarmor, 5);
    this.addAttributeModifier(AttributeTypes.intelligence, 10);
    this.addAttributeModifier(AttributeTypes.agility, 20);
    this.addAttributeModifier(AttributeTypes.speed, 20);
    this.addAttributeModifier(AttributeTypes.endurance, 10);
    this.addAttributeModifier(AttributeTypes.luck, 20);
}